﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kaiser.Modules.Hiner.Models.Product;
using Kaiser.Repositories.iBatis.HINER;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Kaiser.Modules.Test
{
    [TestClass()]
    [DeploymentItem(@"Kaiser.Site\Maps", "Maps")]
    [DeploymentItem(@"Kaiser.Site\Configs", "Configs")]
    public class ProductTest
    {
        public ProductRepositorie ProductRepositorie
        {
            get
            {
                return new ProductRepositorie();
            }
        }

        /// <summary>
        ///Order 构造函数 的测试
        ///</summary>
        [TestMethod()]
        public void InsertProdut()
        {
            try
            {
                var target = new Product(ProductRepositorie); 
                ProductBase model = new ProductBase();
                model.ProductId = Guid.NewGuid().ToString();
                model.SupplierName = "Test111";
                model.SupplierCode = "Test";
                model.CreateDateTime = DateTime.Now;
                model.CreateUserFullName = "admin";
                model.CreateUserName = "admin";
                target.Insert(model);
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }


        /// <summary>
        ///Order 构造函数 的测试
        ///</summary>
        [TestMethod()]
        public void DeleteProdut()
        {
            try
            {
                var target = new Product(ProductRepositorie); 
                ProductBase model = new ProductBase();
                model.ProductId = Guid.NewGuid().ToString();
                model.SupplierName = "Test111";
                model.SupplierCode = "Test";
                model.CreateDateTime = DateTime.Now;
                model.CreateUserFullName = "admin";
                model.CreateUserName = "admin";
                target.Insert(model);


                int i = target.Delete(model.ProductId);
                Assert.IsTrue(i > 0);
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }

       

    }
}
